Skip to content

feat: revalidation cron changed to gbfs#95

Merged
Alessandro100 merged 1 commit intomainfrom
feat/67-revalidate-cron-updated
Apr 9, 2026
Merged

feat: revalidation cron changed to gbfs#95
Alessandro100 merged 1 commit intomainfrom
feat/67-revalidate-cron-updated

Conversation

@Alessandro100
Copy link
Copy Markdown
Contributor

Summary:

part 1/3 of #67

Changes the revalidation cron from revalidating everything to just gbfs feeds. gtfs and gtfs_rt are going to be revalidated outside of this system

Expected behavior:

From monday to saturday at 4am utc and on sunday 7am utc we will revalidate all the gbfs feed cache. From mon-sat is the estimated time of validation finishing in GCP, and on sunday is the estimated time of geolocation finishing

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with yarn test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@Alessandro100 Alessandro100 requested a review from cka-y April 1, 2026 17:28
@Alessandro100 Alessandro100 self-assigned this Apr 1, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mobilitydatabase-web Ready Ready Preview, Comment Apr 9, 2026 5:24pm

Request Review

@cka-y
Copy link
Copy Markdown
Contributor

cka-y commented Apr 1, 2026

@Alessandro100 this shouldn't be merged before #67 is completed right?

@Alessandro100
Copy link
Copy Markdown
Contributor Author

yeah this shouldn't be merged before the rest of #67 is complete

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

*Lighthouse ran on https://mobilitydatabase-2puro4qqj-mobility-data.vercel.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 100 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-2puro4qqj-mobility-data.vercel.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 90 🟠 87 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-2puro4qqj-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🔴 38 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-2puro4qqj-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 84 🟠 84 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-2puro4qqj-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 91 🟢 94 🟢 96 🟢 100

@Alessandro100 Alessandro100 force-pushed the feat/67-revalidate-cron-updated branch from 5a74dea to 9c16c73 Compare April 9, 2026 17:21
@Alessandro100 Alessandro100 marked this pull request as ready for review April 9, 2026 17:21
Copy link
Copy Markdown
Contributor

@cka-y cka-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

AVAILABLE_LOCALES: ['en', 'fr'],
}));

describe('GET /api/revalidate', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it a POST?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Vercel Cron job they use GET, for external API we use POST

},
{
"path": "/api/revalidate",
"schedule": "0 7 * * 0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] these two schedules are specific to gbfs feeds. is it specified anywhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's documented in src/app/api/revalidate/route.ts since we can't add comments in json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so calling /api/revalidate with no parameters automatically revalidates all gbfs feeds?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the GET request which is blocked by process.env.CRON_SECRET yes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current approach couples the GBFS scope to "no params passed," which feels a bit implicit. A few concerns:

  • The endpoint name /api/revalidate reads as generic, but calling it without params actually means "revalidate all GBFS feeds", which is surprising behavior for anyone not already familiar with the route.
  • Documenting this in route.ts works for contributors reading the code, but the schedule config itself gives no indication that it's GBFS-specific.
  • If we ever add another feed type with its own revalidation schedule, this pattern doesn't scale cleanly.

Would it make sense to either:

  1. Use an explicit query param like /api/revalidate?type=gbfs, or
  2. Split into a dedicated route like /api/revalidate/gbfs?

Either would make the schedules self-documenting and avoid relying on the "no params = GBFS" convention. wdyt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that at the moment it's a little generic, adding gbfs in the path or as a param would make it much more clear when reading at a glance

@Alessandro100 Alessandro100 merged commit b748f72 into main Apr 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants